<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
         xmlns:ui="http://java.sun.com/jsf/facelets"
         xmlns:h="http://java.sun.com/jsf/html"
         xmlns:f="http://java.sun.com/jsf/core"
         xmlns:p="http://primefaces.org/ui">
    <h:head>
	<title>insert title here</title>
	<meta http-equiv="Content-Type" content="text/html;charset=utf-8"></meta>
</h:head>
<h:body>
	<ui:composition template="/templates/khungchinh.xhtml">
		<ui:define name="tieudetrang">
            #{msgs.tieudetrangadmin}
         </ui:define>
		<ui:define name="javascrip">
			<h:outputScript library="javascrip" name="update.js"/>
		</ui:define>
		<ui:define name="phandau">
			<div class="daude">#{msgs.loichaotrangadmin}</div>
		</ui:define>
		<ui:define name="noidung">
					<div id="suasanpham">
					<h:form enctype="multipart/form-data" acceptcharset="utf-8">
						<h:panelGrid columns="2">
			<h:outputText value="#{msgs.tenSanPham}"></h:outputText>
			<h:outputText value="#{beanSuaSanPham.selectedSanPham.ten}"></h:outputText>
         	#{msgs.gia}
         	<h:panelGroup>
         	<p:inputText value="#{beanSuaSanPham.selectedSanPham.gia}" id="gia"
								title="#{msgs.nhacnhogia}" onkeypress="return digitonly(event)">
								<f:convertNumber pattern="###,###,###"></f:convertNumber>
								<f:ajax event="blur" render="@this"></f:ajax>
							</p:inputText>
			<h:outputText value="Giá phải lớn hơn 5,000,000" styleClass="loi" rendered="#{beanSuaSanPham.loigia}"></h:outputText>
			</h:panelGroup>
			
         	#{msgs.hang}
         	<h:panelGroup>
            <p:autoComplete id="hang" maxResults="5"
								value="#{beanSuaSanPham.selectedSanPham.nhasanxuat}"
								completeMethod="#{beanSanPham.complete}" 
								title="#{msgs.nhacnhoten}"
								/>
			<h:outputText value="Không được bỏ trống" styleClass="loi" rendered="#{beanSuaSanPham.loihang}"></h:outputText>
			</h:panelGroup>
         	#{msgs.baoHanh}
         	<p:inputText value="#{beanSuaSanPham.selectedSanPham.baoHanh}"></p:inputText>
         	
         	#{msgs.cpu}
         	<p:inputText value="#{beanSuaSanPham.selectedSanPham.cpu}"></p:inputText>
         	#{msgs.ram}
         	<p:inputText value="#{beanSuaSanPham.selectedSanPham.ram}"></p:inputText>
         	#{msgs.hdd}
         	<p:inputText value="#{beanSuaSanPham.selectedSanPham.hdd}"></p:inputText>
         	#{msgs.manHinh}
         	<p:inputText value="#{beanSuaSanPham.selectedSanPham.manHinh}"></p:inputText>
         	#{msgs.doHoa}
         	<p:inputText value="#{beanSuaSanPham.selectedSanPham.doHoa}"></p:inputText>
         	#{msgs.oDia}
         	<p:inputText value="#{beanSuaSanPham.selectedSanPham.oDia}"></p:inputText>
         	#{msgs.wifi}
         	<p:inputText value="#{beanSuaSanPham.selectedSanPham.wifi}"></p:inputText>
         	#{msgs.webcam}
         	<p:inputText value="#{beanSuaSanPham.selectedSanPham.webcam}"></p:inputText>
         	#{msgs.pin}
         	<p:inputText value="#{beanSuaSanPham.selectedSanPham.pin}"></p:inputText>
         	#{msgs.hdh}
         	<p:inputText value="#{beanSuaSanPham.selectedSanPham.hdh}"></p:inputText>
         	#{msgs.hinh}
         	<h:panelGroup>
         	<p:fileUpload value="#{beanSuaSanPham.fileUpload}" mode="simple" id="hinh"/>
         	<h:outputText rendered="#{beanSuaSanPham.loifile}" value="Phải là file jpg, jpeg, gif, png" styleClass="loi"></h:outputText>
         	</h:panelGroup>
						</h:panelGrid>
						<br />
         #{msgs.khuyenMai} <br />
						<p:editor value="#{beanSuaSanPham.selectedSanPham.khuyenMai}"></p:editor>
						<br />
						<div id="luusanpham">
						<h:commandLink
						actionListener="#{beanSuaSanPham.upload}"
						action="#{beanSuaSanPham.luusanpham}"
						>
						<p:button value="#{msgs.capnhat}"
						></p:button>
						</h:commandLink>		
								<h:commandLink
								action="#{beanSuaSanPham.xoasanpham}">
									<p:button value="#{msgs.xoa}">
									</p:button>
								</h:commandLink> 
								
								<h:commandLink action="#{beanSuaSanPham.quaylai}" immediate="true">
								<p:button
									value="#{msgs.quaylai}"
								></p:button>
								</h:commandLink> 
						</div>
					</h:form>
					</div>
		</ui:define>
	</ui:composition>
</h:body>
</html>